<?php

use App\Http\Controllers\StaticPagesController;
use Illuminate\Support\Facades\Route;

use App\Http\Controllers\admin\IndexController as AdminIndexController;
use App\Http\Controllers\admin\IndexController as IndexController;

use App\Http\Controllers\home\ArticleController as ArticleController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


//Route::get('/getsanctum2', function () {
//    return ('getsanctum2');
//});
//Route::get('formpost', function (){
//    return '<form method="POST" action="/foo">'. csrf_field() .'<button type="submit">提交</button></form>';
//});
//
//Route::redirect('/here', '/there', '301');
////访问http://blog.laravel8.cn/here 时，直接跳转到 http://blog.laravel8.cn/there了
//
//
//// 视图路由  路由  试图名称（模板定义在./views/article/目录中）   试图数据
//Route::view('/article', 'article/index', ['username' => '暮云归']);
//
//
////路由参数
//Route::get('posts/{userid}/username/{username}', function ($userId, $username){
//    return 'userID:'.$userId. '-- username: '. $username;
//});
//
////http://test.ufo/posts/1/username/niuxitong
//
//
//// 可选参数
////http://blog.laravel8.cn/user  如果不指定参数，就用默认值John
////http://blog.laravel8.cn/user/niuxiong  如果给定值，就用给定的值
//Route::get('user/{name?}', function ($name = 'John') {
//    return $name;
//});
//
////在控制器中路由参数跟参数名是没关系的；只跟顺序有关；
////参数验证：
//Route::get('edit/{id}/{action}', [IndexController::class, 'edit'])->where('id', '[0-9]+');
////laravel 又一次方方面面都为我们考虑到了；
////找到 app/Providers/RouteServiceProvider.php 这个文件；
////在 boot 方法中可以定义全局约束；
//
//
//Route::get('admin/article/index', [ArticleController::class, 'index']);
//Route::get('admin/article/create', [ArticleController::class, 'create']);
//Route::post('admin/article/store', [ArticleController::class, 'store']);
//Route::get('admin/article/show/{id}', [ArticleController::class, 'show']);
//Route::get('admin/article/edit/{id}', [ArticleController::class, 'edit']);
//Route::put('admin/article/update/{id}', [ArticleController::class, 'update']);
//Route::delete('admin/article/destroy/{id}', [ArticleController::class, 'destroy']);
//
//
//
////绑定IndexController控制器下的index()方法
////创建类似于TP中的默认控制器、默认方法
//// http://blog.laravel8.cn/
//Route::get('/', [IndexController::class, 'index']);
////http://blog.laravel8.cn/index
//Route::get('index', [IndexController::class, 'index']);
////http://blog.laravel8.cn/index/index
//Route::get('index/index', [IndexController::class, 'index']);
//
//
////http://blog.laravel8.cn/admin/index/index
//Route::get('admin/index/index', [AdminIndexController::class, 'index']);
////http://blog.laravel8.cn/admin/index/mytest
//Route::get('admin/index/mytest', [AdminIndexController::class, 'mytest']);
//
//Route::prefix('admin/article')->group(function (){
//    Route::get('index', [ArticleController::class, 'index']);
//    Route::get('create', [ArticleController::class, 'create']);
//    Route::post('store', [ArticleController::class, 'store']);
//    Route::get('show/{id}', [ArticleController::class, 'show']);
//    Route::get('edit/{id}', [ArticleController::class, 'edit']);
//    Route::put('update/{id}', [ArticleController::class, 'update']);
//    Route::delete('destroy/{id}', [ArticleController::class, 'destroy']);
//});
//
////使用http://blog.laravel8.cn/admin/article/index 就可以访问了

Route::get('/', function () {
    return view('welcome');
});



Route::get('/', [StaticPagesController::class,'home'])->name('home');
//Route::get('/', "iwegfiewu");

Route::get('/help', [StaticPagesController::class,'help'])->name('help');
Route::get('/about', [StaticPagesController::class,'about'])->name('about');

Route::get('signup', 'UsersController@create')->name('signup');

Route::resource('users','UsersController');

Route::get('login', 'SessionsController@create')->name('login');
Route::post('login', 'SessionsController@store')->name('loginpost');
Route::delete('logout', 'SessionsController@destroy')->name('logout');















